
class Person:

    def __init__(self, card, name, salary):
        """

        :param card: id
        :param name: 姓名
        :param salary:薪水
        """
        self.__card = card
        self.__name = name
        self.__salary = salary

    # 注意先get、再set
    @property
    def name(self):
        return self.__name

    @name.setter
    def name(self, name):
        self.__name = name

    def get_card(self):
        return self.__card

    def salary(self):
        return self.__salary

    def __str__(self):
        return "工号：{},姓名：{},薪资：{}".format(self.__card, self.__name, self.__salary)


class Worker(Person):
    def __init__(self, card, name, hour, hour_salary):
        super(Worker, self).__init__(card, name, hour * hour_salary)
        """

        :param hour: 工作小时
        :param hour_salary: 时薪
        """
        self.__hour = hour
        self.__hour_salary = hour_salary


class SelaMan(Person):
    def __init__(self, card, name, sales, commission):
        super(SelaMan, self).__init__(card, name, sales * commission)
        """

        :param sales: 销售额
        :param commission: 提成比例
        """
        self.__sales = sales
        self.__commission = commission
        self.__salary = sales * commission

    def salary(self):
        return self.__salary


class Manager(Person):
    def __init__(self, card, name, month_salary):
        """

        :param card:  身份id
        :param name: 姓名
        :param month_salary: 月薪
        """
        self.month_salary = month_salary
        super().__init__(card, name, month_salary)

    def salary(self):
        return self.month_salary


class SaleManager(SelaMan):
    def __init__(self, card, name, sales, commission, month_salary):
        self.__month_salary = month_salary
        self.__sales = sales
        self.commission = commission
        super().__init__(card, name, sales, commission)

    def salary(self):
        return self.__month_salary + self.__sales * self.commission


w = Worker(1, "张三", 168, 50)
print("工人工资：", w.salary())
print(w)

s = SelaMan(2, "李四", 500000, 0.1)
print("销售人员工资：", s.salary())
print(s)

m = Manager(3, "王五", 20000)
print("管理人员工资：", m.salary())
print(m)

sm = SaleManager(4, "赵六", 50000, 0.1, 25000)
print("销售主管工资：", sm.salary())
print(sm)
